const express = require('express');
const router = express.Router();
const orderController = require('../controllers/orderController');
const { updateOrderPaymentStatus } = require('../controllers/orderController');
// 创建订单
router.post('/orders/create', orderController.createOrder);

// 更新订单支付状态
router.post('/orders/update-payment', updateOrderPaymentStatus);

// 获取用户所有订单
router.get('/orders/:userId', orderController.getOrderDetails);

// 获取单个订单详情
router.get('/orders/detail/:orderId', orderController.getOrderById);

// 获取某个商品所有购买的订单
router.get('/orders/productId/:productId', orderController.getOrdersByProductHandler);

// 根据商家 ID 获取订单
router.get('/orders/seller/:sellerId', orderController.getOrdersBySellerHandler);
// 删除订单
router.post('/orders/delete', orderController.deleteOrderHandler);

// 编辑订单
router.post('/orders/edit', orderController.editOrderHandler);
// 取消订单

router.post('/orders/:orderId/cancel', orderController.cancelOrder);

// 获取用户所有订单
router.get('/orders/mylist/:userId', orderController.getUserOrderList);

module.exports = router;
